package com.sw.chinesewriteboard.model.data

import android.content.Context
import android.graphics.Typeface
import com.sw.chinesewriteboard.R
import com.sw.chinesewriteboard.model.MyColor
import com.sw.chinesewriteboard.model.MyTypeface

class Chinese(val context: Context?) {
    var text: String? = null
    var myTypeface: MyTypeface? = null
    var backgroundColor: MyColor? = null
    var fontColor: MyColor? = null
    var supportPinyin = false

    val ASSET_FONT_FOLDER = "fonts/"
    private var mContext: Context? = null

    init {
        backgroundColor = MyColor("红色", mContext!!.getColor(R.color.colorRed))
        fontColor = MyColor("灰色", mContext!!.getColor(R.color.colorGray))
        myTypeface = MyTypeface(
            "楷体",
            Typeface.createFromAsset(mContext!!.assets, ASSET_FONT_FOLDER + "楷体")
        )
    }

    constructor(
        text: String?,
        typeface: MyTypeface?,
        backgroundColor: MyColor?,
        fontColor: MyColor?,
        supportPinyin: Boolean,
        context: Context?
    ) : this(context = context) {
        this.text = text
        myTypeface = typeface
        this.backgroundColor = backgroundColor
        this.fontColor = fontColor
        this.supportPinyin = supportPinyin
        mContext = context
    }

}